const actions = {
    //响应组件中加的动作
	jia(context, value){
		context.commit('JIA',value)
	},
    getData({ commit, state }, value) {
        console.log('payload>>>>>>>>>>>>>>', value);
        return new Promise((resolve, reject) => {
            resolve({
                name: 'tom',
                age: 18
            })
        })

    }
}

const mutations = {
    //执行加
	JIA(state, value){
		console.log('mutations中的JIA被调用了',state,value)
		state.sum += value
	}
}

//初始化数据
const state = {
   sum: 20
}

const getters = {
	bigSum(state){
        console.log('getterState>>>>>>>>', state);
		return state.sum * 10
	}
}

//创建并暴露store
export default {
	actions,
	mutations,
	state,
    getters,
}